import React from 'react';
import { useSelector, useDispatch } from '../react-redux';
class Counter1 extends React.Component {
    render() {
        let dispatch = useDispatch();
        let mapStateToProps = state => state.counter1;
        let state = useSelector(mapStateToProps);
        return (
            <div>
                <p>{state.number}</p>
                <button onClick={() => dispatch({type: 'ADD1'})}>加</button>
                <button onClick={() => dispatch({type: 'MINUS1'})}>减</button>
                <button onClick={() => dispatch({type: 'MINUS'})}>减</button>
            </div>
        )
    }
}

export default Counter1;
